package com.cskaoyan.shopping.service.impl;


import com.cskaoyan.shopping.converter.ProductCateConverter;
import com.cskaoyan.shopping.converter.ProductCateConverterImpl;
import com.cskaoyan.shopping.dal.entitys.ItemCat;
import com.cskaoyan.shopping.dal.persistence.ItemCatMapper;
import com.cskaoyan.shopping.dto.ProductCateDto;
import com.cskaoyan.shopping.service.IProductCateService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IProductCateServiceImpl implements IProductCateService {

    @Autowired
    ItemCatMapper itemCatMapper;

    @Autowired
    ProductCateConverter productCateConverter;

    /**
     * 列举所有商品种类默认按照
     * @param sort
     * @return
     */
    @Override
    public List<ProductCateDto> getAllProductCate(String sort) {
        List<ItemCat> itemCats = itemCatMapper.selectProductCate();
        List<ProductCateDto> productCateDtos = productCateConverter.items2Dto(itemCats);
        return productCateDtos;
    }

}
